export default {
    namespaced: true,
    state: {
        access: JSON.parse(sessionStorage.getItem('ACCESS_KEY')) || [], // 默认入口名为空，如：'superAdmin'
        token: JSON.parse(sessionStorage.getItem('TOKEN_KEY')) || [],
    },
    mutations: {
        updateAccess(state, access) {
            if (access !== undefined && access !== null) {
                state.access = access;
                sessionStorage.setItem('ACCESS_KEY', JSON.stringify(access));
            } else {
                state.access = [];
                sessionStorage.removeItem('ACCESS_KEY');
            }
        },
        updateToken(state, value) {
            if (value !== undefined && value !== null) {
                state.token = value;
                sessionStorage.setItem('TOKEN_KEY', JSON.stringify(value));
            } else {
                state.token = [];
                sessionStorage.removeItem('TOKEN_KEY');
            }
        },
    },
    getters: {},
    actions: {},
};
